#ifndef _ROS_learning_test_sensor2_h
#define _ROS_learning_test_sensor2_h

#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "ros/msg.h"

namespace learning_test
{

  class sensor2 : public ros::Msg
  {
    public:
      typedef float _DS18B20_temperature_type;
      _DS18B20_temperature_type DS18B20_temperature;
      typedef float _DHT11_temperature_type;
      _DHT11_temperature_type DHT11_temperature;
      typedef float _humidity_type;
      _humidity_type humidity;

    sensor2():
      DS18B20_temperature(0),
      DHT11_temperature(0),
      humidity(0)
    {
    }

    virtual int serialize(unsigned char *outbuffer) const override
    {
      int offset = 0;
      union {
        float real;
        uint32_t base;
      } u_DS18B20_temperature;
      u_DS18B20_temperature.real = this->DS18B20_temperature;
      *(outbuffer + offset + 0) = (u_DS18B20_temperature.base >> (8 * 0)) & 0xFF;
      *(outbuffer + offset + 1) = (u_DS18B20_temperature.base >> (8 * 1)) & 0xFF;
      *(outbuffer + offset + 2) = (u_DS18B20_temperature.base >> (8 * 2)) & 0xFF;
      *(outbuffer + offset + 3) = (u_DS18B20_temperature.base >> (8 * 3)) & 0xFF;
      offset += sizeof(this->DS18B20_temperature);
      union {
        float real;
        uint32_t base;
      } u_DHT11_temperature;
      u_DHT11_temperature.real = this->DHT11_temperature;
      *(outbuffer + offset + 0) = (u_DHT11_temperature.base >> (8 * 0)) & 0xFF;
      *(outbuffer + offset + 1) = (u_DHT11_temperature.base >> (8 * 1)) & 0xFF;
      *(outbuffer + offset + 2) = (u_DHT11_temperature.base >> (8 * 2)) & 0xFF;
      *(outbuffer + offset + 3) = (u_DHT11_temperature.base >> (8 * 3)) & 0xFF;
      offset += sizeof(this->DHT11_temperature);
      union {
        float real;
        uint32_t base;
      } u_humidity;
      u_humidity.real = this->humidity;
      *(outbuffer + offset + 0) = (u_humidity.base >> (8 * 0)) & 0xFF;
      *(outbuffer + offset + 1) = (u_humidity.base >> (8 * 1)) & 0xFF;
      *(outbuffer + offset + 2) = (u_humidity.base >> (8 * 2)) & 0xFF;
      *(outbuffer + offset + 3) = (u_humidity.base >> (8 * 3)) & 0xFF;
      offset += sizeof(this->humidity);
      return offset;
    }

    virtual int deserialize(unsigned char *inbuffer) override
    {
      int offset = 0;
      union {
        float real;
        uint32_t base;
      } u_DS18B20_temperature;
      u_DS18B20_temperature.base = 0;
      u_DS18B20_temperature.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
      u_DS18B20_temperature.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
      u_DS18B20_temperature.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
      u_DS18B20_temperature.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
      this->DS18B20_temperature = u_DS18B20_temperature.real;
      offset += sizeof(this->DS18B20_temperature);
      union {
        float real;
        uint32_t base;
      } u_DHT11_temperature;
      u_DHT11_temperature.base = 0;
      u_DHT11_temperature.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
      u_DHT11_temperature.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
      u_DHT11_temperature.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
      u_DHT11_temperature.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
      this->DHT11_temperature = u_DHT11_temperature.real;
      offset += sizeof(this->DHT11_temperature);
      union {
        float real;
        uint32_t base;
      } u_humidity;
      u_humidity.base = 0;
      u_humidity.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
      u_humidity.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
      u_humidity.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
      u_humidity.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
      this->humidity = u_humidity.real;
      offset += sizeof(this->humidity);
     return offset;
    }

    virtual const char * getType() override { return "learning_test/sensor2"; };
    virtual const char * getMD5() override { return "9aec1dfd2fb021817d90eb22e01110cd"; };

  };

}
#endif
